< previous page page_237 next page >

Page 237
is likely in the case of the wtypes.h file used here, which includes critical data type declarations used by Windows), you run the risk of declaring functions or structures multiple times. The use of conditional compilation constants shown here serves to prevent this error:
// The following four lines define a new type called a LPGUID if the
// constant __LPGUID_DEFINED__  is not yet defined. An LPGUID is a
// Long Pointer to a GUID
#if !defined( _LPGUID_DEFINED__ )
#define __LPGUID_DEFINED_
typedef GUID __RPC_FAR *LPGUID;
#endif // !__LPGUID_DEFINED__
It's good to know what an LPGUID is, in case it is used later as a function parameter. But since it's a pointer, you know that it will be a 32-bit pointer value. The term __RPC_FAR will be described shortly.
// The following lines define a structure called an OBJECTID.
// It's completely irrelevant to this puzzle. In fact, I don't
// recall ever using this particular structure for anything.
#ifndef __OBJECTID_DEFINED
#define __OBJECTID_DEFINED
#define __OBJECTID_DEFINED
typedef struct _OBJECTID
    {
    GUID Lineage;
    unsigned long Uniquifier;
    } OBJECTID;
#endif // !_OBJECTID_DEFINED

#if !defined( _IID_DEFINED__ )  // If the __IID_DEFINED__ _
// constant is already defined, _
// skip the following
#define __IID_DEFINED__  // Define the __IID_DEFINED__ constant
typedef GUID IID;        // An IID is a GUID

typedef IID __RPC_FAR *LPIID;  // An LPIID is a pointer to an IID

typedef GUID CLSID;            // A CLSID is a GUID as well
#endif
What is the meaning of the term __RPC_FAR in the LPIID and LPGUID declarations?
If you look in the C header file rpc.h, you'll find the following definition:

 
< previous page page_237 next page >